package com.bus;

import com.google.common.eventbus.EventBus;

public class TestBus {

    public static void main(String[] args) {
        DataObserver1 observer1 = new DataObserver1();
        DataObserver2 observer2 = new DataObserver2();
        EventBusCenter.register(observer1);
        EventBusCenter.register(observer2);
        System.out.println("================starter==============================");
        //只有注册的参数类型为string类型 方法才会被调用
        EventBusCenter.post("post string method");

        EventBusCenter.post(123);

        System.out.println("============注销观察时事件=====================");
        EventBusCenter.unregister(observer2);
        EventBusCenter.post("post string method");
        EventBusCenter.post(123);

        System.out.println("=============== end =================");



    }
}
